package com.library.utils;

import java.lang.reflect.Field;
import java.util.ArrayList;

public class GetResultsUtils {

	public static ArrayList<String> ConvertObjToMap(Object obj){     
		ArrayList<String> list=new ArrayList<String>();     
		if (obj == null)     
			return null;     
		Field[] fields = obj.getClass().getDeclaredFields();    
		try {       
			for(int i=0;i<fields.length;i++){     
				try {      
					Field f = obj.getClass().getDeclaredField(fields[i].getName());       
					f.setAccessible(true);         
					Object o = f.get(obj); 
					if(o==null) {list.add("");}
					else {
						list.add(o.toString());  }    
					} catch (NoSuchFieldException e) {   
						// TODO Auto-generated catch block    
						e.printStackTrace();          
						} catch (IllegalArgumentException e) {       
					// TODO Auto-generated catch block         
					e.printStackTrace();         
					} catch (IllegalAccessException e) {   
						// TODO Auto-generated catch block         
						e.printStackTrace();      
						}       
				}       
			} catch (SecurityException e) {       
				// TODO Auto-generated catch block      
				e.printStackTrace();      
				}      
		return list;    
				}
	}
